/*
package chapter06

/**
  * create by undeRdoG on  2021-06-02  13:33
  * 凡心所向，素履以往，生如逆旅，一苇以航。
  */
object Test13_Trait {
  def main(args: Array[String]): Unit = {
    val student1 = new Student13()

    student1.study()
    student1.dating()
    student1.sayHello()
  }
}


// 定义父类
class Person13{
  val name = "person"
  val age = 18

  def sayHello(): Unit ={
    println(s"name is ${name} and age is ${age}")
  }

}

// 定义一个特质  trait
trait young{
  //声明抽象和非抽象的属性
  var age:Int
  val name: String = "young"

  // 声明抽象和非抽象的方法
  def play()={
    println("young people is playing")
  }

  def dating(): Unit
}


class Student13 extends Person13 with young {


  // 重写冲突属性
  override val name: String = "student"

  // 实现抽象方法
  override def dating():Unit = println(s"student $name is dating")


   def study():Unit = println(s"student $name is study")

  // 重写父类方法
  override def sayHello(): Unit =
  {
    super.sayHello()
    println(s"hello from ${name}")
  }
}*/
